<template>
  <div class="app-container">
    <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
      <el-menu-item index="1">综合查询</el-menu-item>
      <el-menu-item index="2">载荷差数据</el-menu-item>
<!--      <el-menu-item index="3">载荷差数据</el-menu-item>-->
<!--      <el-menu-item index="4">功图数据</el-menu-item>-->
<!--      <el-menu-item index="5">修井记录</el-menu-item>-->
    </el-menu>
    <div class="cont">
      <component1 v-if="activeIndex=='1'" />
      <component2 v-else-if="activeIndex=='2'"   />
      <component3 v-else-if="activeIndex=='3'"  />
    </div>
  </div>
</template>

<script>
import component1 from './components/component1.vue'
import component2 from './components/component2.vue'
import component3 from './components/component3.vue'
export default {
  components: {
    component1,
    component3,
    component2
  },
  data() {
    return {
      activeIndex: '1'
    }
  },
  methods: {
    handleSelect(index) {
      this.searchData = {}
      this.activeIndex = index
    },
    // jump() {
    //   console.log('777')
    // },
    // encrypt2(txt) {
    //   const publicKey2 = `MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJL0JkqsUoK6kt3JyogsgqNp9VDGDp+t3ZAGMbVoMPdHNT2nfiIVh9ZMNHF7g2XiAa8O8AQWyh2PjMR0NiUSVQMCAwEAAQ==`;
    //   const encryptor = new JSEncrypt();
    //   encryptor.setPublicKey(publicKey2);
    //   return encryptor.encrypt(txt);
    // },
    // tyrz(username, password) {
    //   var formdata = new FormData();
    //   formdata.append("grant_type", "password");
    //   formdata.append("username", username);
    //   formdata.append("password", encrypt2(password));
    //   formdata.append("client_id", "djzd");
    //   formdata.append("client_secret", "djzd#2023!");
    //   console.log(encrypt2(password))
    //
    //   var requestOptions = {
    //     method: "POST",
    //     body: formdata,
    //     redirect: "follow",
    //   };
    //
    //   fetch("http://api.iosp.xjyt.petrochina/oauth/oauth/token", requestOptions)
    //     .then((response) => response.json())
    //     .then((result) => {
    //       if (result.error) {
    //         alert(result.error);
    //       } else {
    //         let token = result.access_token;
    //         console.log(token)
    //       }
    //     })
    //     .catch((error) => {
    //       console.log("error", error);
    //     });
    //   window.location.replace('http://djwtzd.iosp.xjyt.petrochina/djwtzd/?access_token=1e3cec5a-0781-45f8-addf-abe493249444/oilWellDetailsIndex?well_id')
    // },
  }
}
</script>

<style scoped>

</style>
